import request from "./index.js"

// 获取学生申报/选择课题列表
export function getStudentSubjectList() {
  return request({
    method:'get',
    url: '/subject/student'  
  })
}

// 获取课题类型列表
export function getSubjectTypeList() {
  return request({
    method:'get',
    url: '/type/all'  
  })
}

// 获取课题来源列表
export function getSubjectSourceList() {
  return request({
    method:'get',
    url: '/source/all'  
  })
}
// 学生取消申报课题   
export function removeSubjectBySubId(id) {
  return request({
    method:'get',
    url: `/subject/remove/${id}`
  })
}

// 学生申报课题 
export function studentDeclareSubject(data) {
  return request({
    method:'post',
    url: '/subject/student/declare',
    data 
  })
}

// 通过课题 id 查询课题信息  
export function getSubjectById(subjectId) {
  return request({
    method:'get',
    url: `/subject/${subjectId}`
  })
}

// 学生修改课题
export function studentUpdateSubject(data) {
  return request({
    method:'post',
    url: '/subject/student/update',
    data 
  })
}

// 获取可选课题列表的总数(用以确定总页码)
export function getCanSelectSubjectTotal() {
  return request({
    method:'get',
    url: '/subject/can-select/total'
  })
}

// 获取指定页的可选课题列表
export function getCanSelectSubjectByPage(data) {
  return request({
    method:'post',
    url: '/subject/can-select/page',
    data 
  })
}
// 判断当前学生是否可选则课题
export function judgeStudentCanChooseOrNot() {
  return request({
    method:'get',
    url: '/subject/student/can-select/judge' 
  })
}


// 学生选择指定 id 课题
export function selectSubjectById(id) {
  return request({
    method:'get',
    url: `/subject/student/choose/${id}` 
  })
}

// 获取当前学生是否已选课题，如果已选，返回该课题 id
export function getStudentSelectedSubject() {
  return request({
    method:'get',
    url: '/subject/student/selected', 
  })
}

// 获取教师申报课题列表
export function getTeacherSubjectListByPage(data) {
  return request({
    method:'post',
    url: '/subject/teacher',
    data
  })
}
// 获取教师申报课题总数
export function getTeacherSubjectTotal() {
  return request({
    method:'get',
    url: '/subject/teacher/total' 
  })
}
// 教师取消申报指定 id 课题
export function teacherCancelDeclareBySubId(id) {
  return request({
    method:'get',
    url: `/subject/teacher/cancel/${id}`
  })
}


// 教师申报课题
export function teacherDeclareSubject(data) {
  return request({
    method:'post',
    url: '/subject/teacher/declare',
    data 
  })
}

// 教师修改课题
export function teacherUpdateSubject(data) {
  return request({
    method:'post',
    url: '/subject/teacher/update',
    data 
  })
}

// 教师获取课题列表-->为了给学生打分
export function getTeacherSubjectListForScoreByPage(data) {
  return request({
    method:'post',
    url: '/subject/teacher/score',
    data
  })
}
// 教师获取课题列表-->为了给学生打分
export function getTeacherSubjectListForScoreTotal() {
  return request({
    method:'get',
    url: '/subject/teacher/score/total' 
  })
}

// 学院领导获取需要审核的课题列表
export function getLeaderCheckSubjectList(data) {
  return request({
    method:'post',
    url: '/subject/leader/check',
    data
  })
}
// 获取学院领导未审核课题总数
export function getLeaderCheckSubjectTotal() {
  return request({
    method:'get',
    url: '/subject/leader/check/total' 
  })
}
// 学院领导审核指定 id 的课题
export function checkSubjectById(id, status, checkAdvice) { 
  const data = { status, checkAdvice }
  return request({
    method:'post',
      url: `/subject/leader/check/${id}`,
      data 
  })
}

// 学院领导获取已审核的课题列表
export function getLeaderCheckedSubjectListByPage(data) {
  return request({
    method:'post',
    url: '/subject/leader/checked',
    data
  })
}
// 获取学院领导已审核课题总数
export function getLeaderCheckedSubjectTotal() {
  return request({
    method:'get',
    url: '/subject/leader/checked/total' 
  })
}
// 学院领导撤销审核指定 id课题
export function leaderCancelCheckedSubject(id) {
  return request({
    method:'get',
    url: `/subject/leader/checked/cancel/${id}`
  })
}


